package com.witframework.web.tag.fieldsettag;


import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTagSupport;


public class DataBodyTag extends BodyTagSupport
{
  private String sBody = null;
  PageContext pageContext;

  public void setPageContext(PageContext paramPageContext)
  {
    this.pageContext = paramPageContext;
  }

  public PageContext getPageContext()
  {
    return this.pageContext;
  }

  public int doAfterBody()
    throws JspException
  {
    BodyContent localBodyContent = getBodyContent();
    if (localBodyContent == null)
      this.sBody = "";
    else
      this.sBody = localBodyContent.getString();
    return 0;
  }

  public int doEndTag()
    throws JspException
  {
    FieldsetTag localFieldsetTag = (FieldsetTag)findAncestorWithClass(this, FieldsetTag.class);
    if (localFieldsetTag == null)
      throw new JspException("body tag: could not find ancestor fieldset");
    localFieldsetTag.setDataBody(this.sBody);
    return 6;
  }

  public void release()
  {
    this.sBody = null;
  }
}
